package com.example.demo.request;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

public class UpdateDataSourceRequest {

    @NotBlank(message = "数据源名称不能为空")
    private String name;

    @NotBlank(message = "数据库类型不能为空")
    @Pattern(regexp = "^(MySQL|PostgreSQL|Oracle|SQLServer)$", message = "数据库类型必须是MySQL、PostgreSQL、Oracle或SQLServer")
    private String dbType;

    @NotBlank(message = "主机地址不能为空")
    private String host;

    @NotNull(message = "端口号不能为空")
    private Integer port;

    @NotBlank(message = "用户名不能为空")
    private String username;

    private String password; // 可选，如果不提供则保持原密码

    @NotBlank(message = "数据库名称不能为空")
    private String databaseName;

    private String querySql;

    private String idFields;

    private String displayFields;

    private String extraFields;

    private String dropdownFields;

    private String searchableFields;

    @NotNull(message = "状态不能为空")
    @Pattern(regexp = "^[01]$", message = "状态必须是0或1")
    private Integer status;

    private Integer scheduleEnabled;

    private String scheduleCron;

    private String scheduleDesc;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDbType() {
        return dbType;
    }

    public void setDbType(String dbType) {
        this.dbType = dbType;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public Integer getPort() {
        return port;
    }

    public void setPort(Integer port) {
        this.port = port;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getDatabaseName() {
        return databaseName;
    }

    public void setDatabaseName(String databaseName) {
        this.databaseName = databaseName;
    }

    public String getQuerySql() {
        return querySql;
    }

    public void setQuerySql(String querySql) {
        this.querySql = querySql;
    }

    public String getIdFields() {
        return idFields;
    }

    public void setIdFields(String idFields) {
        this.idFields = idFields;
    }

    public String getDisplayFields() {
        return displayFields;
    }

    public void setDisplayFields(String displayFields) {
        this.displayFields = displayFields;
    }

    public String getExtraFields() {
        return extraFields;
    }

    public void setExtraFields(String extraFields) {
        this.extraFields = extraFields;
    }

    public String getDropdownFields() {
        return dropdownFields;
    }

    public void setDropdownFields(String dropdownFields) {
        this.dropdownFields = dropdownFields;
    }

    public String getSearchableFields() {
        return searchableFields;
    }

    public void setSearchableFields(String searchableFields) {
        this.searchableFields = searchableFields;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getScheduleEnabled() {
        return scheduleEnabled;
    }

    public void setScheduleEnabled(Integer scheduleEnabled) {
        this.scheduleEnabled = scheduleEnabled;
    }

    public String getScheduleCron() {
        return scheduleCron;
    }

    public void setScheduleCron(String scheduleCron) {
        this.scheduleCron = scheduleCron;
    }

    public String getScheduleDesc() {
        return scheduleDesc;
    }

    public void setScheduleDesc(String scheduleDesc) {
        this.scheduleDesc = scheduleDesc;
    }
}